<template>
	<app-dialog ref="dialog" width="80%" :title="title" @confirm="save">
		<view style="padding: 20rpx">
			<u-form :model="form" :rules="rules" :labelStyle="{ color: '#666' }" labelWidth="auto" labelPosition="top" ref="uFormRef">
				<u-form-item label="相册名称" prop="corp" required>
					<u-input placeholder="请输入相册名称" v-model="form.corp"></u-input>
				</u-form-item>
			</u-form>
		</view>
	</app-dialog>
</template>

<script>
export default {
	components: {},
	props: {
		type: {
			type: Number,
			default: 0
		}
	},
	data() {
		return {
			title: '新增',
			itemList: null,
			fileList: [],
			detail: null,
			areaId: '',
			form: {corp:""},
			data: null,
			index: '',
			rules: {
				corp: [{ required: true, message: '请输入相册名称', trigger: ['blur'] }]
			}
		};
	},
	
	methods: {
		async open() {
			// 打开弹框
			await this.$refs.dialog.open();
		},

		reset() {
		
		},
		 save() {
			this.$refs.uFormRef.validate().then(res => {
			this.$http.post('/app/xc/saveOrUpdate', {lx:Number(this.type-1), mc:this.form.corp}).then(res => {
					uni.showToast({
							title: '添加成功',
							icon: 'none'
						});
					this.$emit('refreshData')
					this.$refs.dialog.close()
					this.form.corp =''
					}).catch(function (error) {
							uni.showToast({
							title: error.msg,
							icon: 'none'
						});
					})
			})
		}
	}
};
</script>

<style lang="scss" scoped>
.auto {
	// height: 980rpx;
}
</style>
